package view.component.weapon
{
	import feathers.controls.Label;
	
	import model.vo.weapon.BaseShortWeaponVo;
	
	import util.WeaponUtil;
	
	/**
	 * 近身武器详细信息基类
	 * @author £iang
	 * 
	 */	
	public class BaseShortWeaponDetailView extends BaseWeaponDetailView
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 属性标题 */
		public var attributeTitle:Label;
		/** 属性信息 */
		public var attributeLabel:Label;
		/** 斩味标题 */
		public var sharpTitle:Label;
		/** 斩味容器1 */
		public var sharpC1:SharpContainer;
		/** 斩味容器2 */
		public var sharpC2:SharpContainer;
	
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 初始化函数 
		 * 
		 */		
		override protected function initialize():void
		{
			super.initialize();
			attributeTitle = new Label();
			attributeTitle.text = "属性值：";
			mainSC.addChild( attributeTitle );
			
			attributeLabel = new Label();
			attributeLabel.textRendererProperties.isHTML = true;
			mainSC.addChild( attributeLabel );
			
			sharpTitle = new Label();
			sharpTitle.text = "斩味值：";
			mainSC.addChild( sharpTitle );
			
			sharpC1 = new SharpContainer();
			mainSC.addChild( sharpC1 );
			
			sharpC2 = new SharpContainer();
			mainSC.addChild( sharpC2 );
		}
		
		/**
		 * 绘制函数 
		 * 
		 */		
		override protected function draw():void
		{
			super.draw();
			attributeTitle.x = 20 * this.dpiScale;
			attributeTitle.y = 120 * this.dpiScale;
			attributeLabel.x = 150 * this.dpiScale;
			attributeLabel.y = 120 * this.dpiScale;
			
			criticalTitle.x = 20 * this.dpiScale;
			criticalTitle.y = 180 * this.dpiScale;
			criticalLabel.x = 150 * this.dpiScale;
			criticalLabel.y = 180 * this.dpiScale;
			
			slotTitle.x = 20 * this.dpiScale;
			slotTitle.y = 240 * this.dpiScale;
			slotLabel.x = 150 * this.dpiScale;
			slotLabel.y = 240 * this.dpiScale;
		}
		
		/**
		 * 设置详细数据 
		 * @param weaponVo 武器数据
		 * 
		 */		
		public function setShortData( weaponVo:BaseShortWeaponVo ):void
		{
			setData( weaponVo );
			
			var attriStr:String = WeaponUtil.getAttributeLabelText( 
				weaponVo.attribute, weaponVo.attriNum, weaponVo.isAwaken
			);
			
			if ( attriStr == "" )
				attriStr = "无";
			
			attributeLabel.text = attriStr;
			
			var sharpArr1:Array = [
				weaponVo.red1, weaponVo.orange1, weaponVo.yellow1,
				weaponVo.green1, weaponVo.blue1, weaponVo.white1,
				weaponVo.purple1
			];
			
			sharpC1.setSharpData( sharpArr1, false );
			
			var sharpArr2:Array = [
				weaponVo.red2, weaponVo.orange2, weaponVo.yellow2,
				weaponVo.green2, weaponVo.blue2, weaponVo.white2,
				weaponVo.purple2
			];
			
			sharpC2.setSharpData( sharpArr2, true );
			
		
			
		}
		
		/**
		 * 调整部分组件 
		 * @param offsetY 插入某项后的Y偏移
		 * 
		 */		
		protected function drawPart():void
		{
			sharpTitle.x = 20 * this.dpiScale;
			sharpTitle.y = ( 300 + insertOffset ) * this.dpiScale;
			sharpC1.x = 150 * this.dpiScale;
			sharpC1.y = ( 306 + insertOffset ) * this.dpiScale;
			sharpC2.x = 150 * this.dpiScale;
			sharpC2.y = ( 356 + insertOffset ) * this.dpiScale;
			
			productTitle.x = 20 * this.dpiScale;
			productTitle.y = ( 420 + insertOffset ) * this.dpiScale;
			productPriceLabel.x = 150 * this.dpiScale;
			productPriceLabel.y = ( 420 + insertOffset ) * this.dpiScale;
			
			produceItemList.x = 150 * this.dpiScale;
			produceItemList.y = ( 480 + insertOffset ) * this.dpiScale;
			
			strengthTitle.x = 20 * this.dpiScale;
			strengthTitle.y = ( 720 + insertOffset ) * this.dpiScale;
			strengthPriceLabel.x = 150 * this.dpiScale;
			strengthPriceLabel.y = ( 720 + insertOffset ) * this.dpiScale;
			
			strengthItemList.x = 150 * this.dpiScale;
			strengthItemList.y = ( 780 + insertOffset ) * this.dpiScale;
			
			identifyTitle.x = 20 * this.dpiScale;
			identifyTitle.y = ( 1020 + insertOffset ) * this.dpiScale;
			identifyLabel.x = 150 * this.dpiScale;
			identifyLabel.y = ( 1020 + insertOffset ) * this.dpiScale;
			
			identifyItemList.x = 150 * this.dpiScale;
			identifyItemList.y = ( 1020 + insertOffset ) * this.dpiScale;
			
			imageTitle.x = 20 * this.dpiScale;
			imageTitle.y = ( 1140 + insertOffset ) * this.dpiScale;
			imageLabel.x = 190 * this.dpiScale;
			imageLabel.y = ( 1140 + insertOffset ) * this.dpiScale;
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 析构函数 
		 * 
		 */		
		override public function dispose():void
		{
			attributeTitle.dispose(); attributeTitle = null;
			attributeLabel.dispose(); attributeLabel = null;
			sharpTitle.dispose(); sharpTitle = null;
			super.dispose();
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function BaseShortWeaponDetailView()
		{
			super();
			imageY = 1140;
		}
	}
}